home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20021006-20030409 / 000295_fdc@columbia.edu_Thu Feb 13 15:22:07 EST 2003.msg < prev    next >
Text File  |  2020-01-01  |  3KB  |  83 lines

  1. Article: 14092 of comp.protocols.kermit.misc
  2. Path: newsmaster.cc.columbia.edu!news.columbia.edu!news-not-for-mail
  3. From: fdc@columbia.edu (Frank da Cruz)
  4. Newsgroups: comp.protocols.kermit.misc
  5. Subject: Re: Dealing with '\' char in strings of file locations
  6. Date: 13 Feb 2003 14:52:27 -0500
  7. Organization: Columbia University
  8. Lines: 66
  9. Message-ID: <b2gt1r$jmj$1@watsol.cc.columbia.edu>
  10. References: <a70f50e.0302121525.7922c8c3@posting.google.com>
  11. NNTP-Posting-Host: watsol.cc.columbia.edu
  12. X-Trace: newsmaster.cc.columbia.edu 1045165948 26759 128.59.39.139 (13 Feb 2003 19:52:28 GMT)
  13. X-Complaints-To: postmaster@columbia.edu
  14. NNTP-Posting-Date: 13 Feb 2003 19:52:28 GMT
  15. Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:14092
  16.  
  17. In article <a70f50e.0302121525.7922c8c3@posting.google.com>,
  18. Wes <wesdog@hotmail.com> wrote:
  19. : This is my first experience with Kermit... So far I like what I see. 
  20. : However, I do have a question.
  21. : My problem is that I will be running a script from a workstation
  22. : called "serverx".  The script will log into a FTP server and download
  23. : a text file containing a file path in UNC format on each line
  24. : (\\serverx\share\dir\file.txt) which, by the way, references a file on
  25. : the workstation "serverx" (the UNC path would translate into
  26. : c:\share\dir\file.txt).  If that file is located on the workstation
  27. : kermit will upload the file to another FTP server and put it in the
  28. : same sub directory (ftp://servery/dir/).
  29. : Since the UNC format in the file has '\' in it, how do I deal with
  30. : this sitution.  Here is what I have so far...  I am not really sure
  31. : how to proceed.  Any help would be great.
  32. As you know, backslash is a distinguished character in the Kermit command
  33. and scripting language, just as it is in many other scripting languages.
  34. In all these languages, there is an unfortunate conflict with DOS pathnames
  35. and UNCs.  The situation is discussed in "Using C-Kermit" on page 48 and
  36. greater length here:
  37.  
  38.   http://www.columbia.edu/kermit/ckermit70.html#x1.11
  39.  
  40. : One more question, can somebody explain "recursive evaluation" to me?
  41. Kermit has two kinds of user-defined scalar variables: The \%x kind
  42. (which are evaluated recursively) and the \m(name) kind.  The difference
  43. comes into play when a variable's definition includes backslashes.  Whenever
  44. you refer to a recursively evaluated variable, it is evaluated, and then its
  45. value is evaluated, and then that value is evaluated, etc, until done. To
  46. illustrate:
  47.  
  48.   define \%a one
  49.   define \%b two
  50.   define \%c \%a \%b three
  51.   echo \%c                    <-- recursive evaluation
  52.   one two three
  53.   define text \%a \%b three
  54.   echo \m(text)               <-- one-level-deep evaluation
  55.   \%a \%b three  
  56.  
  57. Obviously the intention of recursive evaluation is to handle variables
  58. whose definitions refer to other variables.  Therefore, this type of
  59. variable should not be used to hold DOS pathnames or UNCs.
  60.  
  61. To handle the kind of situation you describe, use one-level-deep
  62. (named) variables:
  63.  
  64.   fopen /read \%c somefile
  65.   if fail ...
  66.   fread /line \%c line
  67.   if fail ...
  68.   
  69. and then refer to the line you have just read as \m(line).  Alternatively
  70. you can use \fdefinition() to evaluate \%x variables one level deep:
  71.  
  72.   fopen /read \%c somefile
  73.   if fail ...
  74.   fread /line \%c \%a
  75.   if fail ...
  76.   echo \fdef(\%a)
  77.  
  78. - Frank
  79.